module.exports = {
    onLoad(options) {},
    onShow() {
        let pages = getCurrentPages();
        if (pages.length >= 1) {
            this.$x.pageRouter = (pages[pages.length - 1]).route
            if (this.$x.pageRouter) {
                this.$x.mpShare = {
                    title: '', // 分享标题
                    // path: '', // 默认为当前页面路径
                    // imageUrl: '' // 默认为当前页面的截图
                }
            }
            return;
        }
    },
    // // 分享到好友
    // onShareAppMessage(el) {
    //     let user_info = uni.getStorageSync('user_info')
    //     return this.$x.mpShare
    // },
    // // 分享到朋友圈
    // onShareTimeline() {
    //     let user_info = uni.getStorageSync('user_info')
    //     return this.$x.mpShare
    // }

    // 分享到好友
    onShareAppMessage(el) {
        let pages = getCurrentPages();
        this.$x.pageRouter = (pages[pages.length - 1]).route
        let query = this.$x.pageRouter
        let user_info = uni.getStorageSync('user_info')
        if (user_info.userId != undefined && user_info.userId != '' && user_info.userId != null) {
            query = query + '?invite_id=' + this.user_info['userId']
        }
        this.$x.mpShare.path = query
        return this.$x.mpShare
    },
    // 分享到朋友圈
    onShareTimeline() {
        let pages = getCurrentPages();
        this.$x.pageRouter = (pages[pages.length - 1]).route
        let query = this.$x.pageRouter
        let user_info = uni.getStorageSync('user_info')
        if (user_info.userId != undefined && user_info.userId != '' && user_info.userId != null) {
            query = query + '?invite_id=' + this.user_info['userId']
        }
        console.log(query)
        this.$x.mpShare.query = query
        return this.$x.mpShare
    }
}